<template>
	<view>
		<!-- adad -->
		<button @tap="goTouched" data-page='/pages/mall/mall'>商城首页 已做完</button>
		<button @tap="goTouched" data-page='/pages/car/car2'>爱车 各模块</button>
		<button @tap="goTouched" data-page='/pages/car/carHome/carHome'>爱车首页 已做完</button>
		<button @tap="snaptshot">获取封面图chooseVideo</button>
		<button @tap="shareTouched">内置分享</button>
		<button @tap="serviceTouched">在线客服</button>
		
		<image width="750upx" height="300upx" style="background-color: rebeccapurple;" :src="snaptshotUrl"></image>
		<image width="750upx" height="300upx" style="background-color: rebeccapurple;" src="@appstatic/car/car_orange_dot.png"></image>
		
		<view  class="test" style="background-color: rebeccapurple;"></view>
		<text>测试0.6.0</text>
	</view>
</template>

<script>
	// #ifdef APP-PLUS
	const PluginModule = uni.requireNativePlugin("PluginModule");
	// #endif
	export default {
		data() {
			return {
				snaptshotUrl:'',
			}
		},
		methods: {
			shareTouched:function(e){
				plus.share.sendWithSystem({type:'text',content:'分享内容',href:'http://www.dcloud.io/'}, function(){
						console.log('分享成功');
					}, function(e){
						console.log('分享失败：'+JSON.stringify(e));
					});
			},
			goTouched:function(e){
				var page = e.currentTarget.dataset.page
				uni.navigateTo({
					url:page
				})
			},
			snaptshot:function(e){
				console.log("snaptshot");
				var that = this;
				uni.chooseVideo({
					count: 1,  //图片可选择数量
					sourceType: ['album','camera'],   //album 从相册选图，camera 使用相机，默认二者都有。
					success: res => {
						let tempFilePath = res.tempFilePath   //图片的本地文件路径列表
						console.log(tempFilePath);
						// #ifdef APP-PLUS
						PluginModule.snapshotVideo({
							"path": tempFilePath,
							"time":'2'
						}, res => {
							console.log(res)
							that.snaptshotUrl = 'file://' + res.data;
						})
						// #endif
					}
				})
							
				
			},
			serviceTouched:function(e){
				// #ifdef APP-PLUS
				PluginModule.startWebView({'title':'在线客服','url':'https://wpa1.qq.com/S92doXo6?_type=wpa&qidian=true&_pid=boqvjc.tgiohg.l6lkpmoi'}, res => {
							console.log(res)
						
				});
				// #endif
				
			}
		}
	}
</script>

<style scoped>
.test{
	background-image: url(@appstatic/car/car_blue_dot.png);
	height: 300rpx;
	width: 500upx;
}
</style>
